#ifndef _GRAPHMATHOBJ_H
#define _GRAPHMATHOBJ_H
#include "CoordinateClass.h"
//#include "GMOVectorClass.h"

#define COORD_PHYS_TO_GL(x,y,z) (y),(z),(x)

struct GMOGLAttributes {
	float color3fv[3];
};

class GraphMathObj
{
	// no gl attributes: an object could have many (colors, display lists, etc.)
public:
	GraphMathObj(void);
	~GraphMathObj(void);
	virtual void StdGLDraw(void)=0;
};


/*
 * Spherical electric field source
 */

class SphericalChargeClass : public GraphMathObj
{
public:
	float radius;
	float Q;
	union {struct {float xpos,ypos,zpos;};float pos[3];};
	GMOGLAttributes attrib;
	SphericalChargeClass(void);

	void E(float *,float *);

	void StdGLDraw(void);
};

#define MYDEF_BLACK			0.0f,0.0f,0.0f
#define MYDEF_WHITE			1.0f,1.0f,1.0f
#define MYDEF_GRAY_50		0.5f,0.5f,0.5f
#define	MYDEF_RED			1.0f,0.0f,0.0f
#define MYDEF_GREEN			0.0f,1.0f,0.0f
#define MYDEF_BLUE			0.0f,0.0f,1.0f
#define MYDEF_CYAN			0.0f,1.0f,1.0f
#define MYDEF_MAGENTA		1.0f,0.0f,1.0f
#define MYDEF_YELLOW		1.0f,1.0f,0.0f

/*
 * transparent buffer stuff
 */

typedef struct {
	union {struct {float x0,x1,x2;};float xo[3];};
	union {struct {float colorR, colorG, colorB, colorA;};float color[4];};
} TranslucentPrimitiveProperties;

typedef struct {
	// support both triangles and squares
	int nPoint;
	float Point[4];
	// calculate representative central point
	union {struct {float centerRef0,centerRef1,centerRef2;}; float centerRef[3];};
	// color, material properties, probably also custom light
	TranslucentPrimitiveProperties *Properties;
} translucent_primitive_class;

// REPRESENTATIVE DEPTH VALUES SHOULD BE IN INDEPENDENT CAMERA STRUCTURES
// OR STUFF
// store representative depth value
//	float depthRefVal;


/*
 * Utility functions
 */

void DrawPointToPointVector(float *,float *);
void LineSegment3f(float a0,float a1,float a2,float b0,float b1,float b2);
void GenerateGLSphere(int);
void GenerateGLSphereFact(int nSeg, void (*factory_func)(translucent_primitive_class whack));
void GenerateGLSphereOct(int);
void GenerateGLCone(float,int);
void GenerateGLCylinder(int);




#endif // _GRAPHMATHOBJ
